package com.aooci.ordercat.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.aooci.ordercat.enums.DiningTableStatus;

@Entity
@Table(name = "DINING_TABLE")
@NamedQueries({
    @NamedQuery(name="DINING_TABLE.findTableByCategoryIdAndStatus",
                query="SELECT dt FROM DiningTable dt WHERE dt.status = :status AND dt.diningTableCategory.id = :diningTableCategoryId ORDER BY dt.id"),
    @NamedQuery(name="DINING_TABLE.findTableByCategoryId",
                query="SELECT dt FROM DiningTable dt WHERE dt.diningTableCategory.id = :diningTableCategoryId ORDER BY dt.id"),
}) 
public class DiningTable extends IdentityEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	@Column(name = "LABEL")
	private String label;
	
	@Enumerated(EnumType.STRING)
	@Column(name = "STATUS")
	private DiningTableStatus status;
	
	@Column(name = "NOF_CLIENT")
	private int nofClient;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ORDERCAT_ID")
	private Ordercat ordercat;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CATEGORY_ID")
	private DiningTableCategory diningTableCategory;

	/**
	 * @return the label
	 */
	public String getLabel() {
		return label;
	}

	/**
	 * @param label the label to set
	 */
	public void setLabel(String label) {
		this.label = label;
	}

	/**
	 * @return the status
	 */
	public DiningTableStatus getStatus() {
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(DiningTableStatus status) {
		this.status = status;
	}

	/**
	 * @return the ordercat
	 */
	public Ordercat getOrdercat() {
		return ordercat;
	}

	/**
	 * @param ordercat the ordercat to set
	 */
	public void setOrdercat(Ordercat ordercat) {
		this.ordercat = ordercat;
	}

	/**
	 * @return the nofClient
	 */
	public int getNofClient() {
		return nofClient;
	}

	/**
	 * @param nofClient the nofClient to set
	 */
	public void setNofClient(int nofClient) {
		this.nofClient = nofClient;
	}

	/**
	 * @return the diningTableCategory
	 */
	public DiningTableCategory getDiningTableCategory() {
		return diningTableCategory;
	}

	/**
	 * @param diningTableCategory the diningTableCategory to set
	 */
	public void setDiningTableCategory(DiningTableCategory diningTableCategory) {
		this.diningTableCategory = diningTableCategory;
	}


}
